﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace FTI
{
    public static partial class Extensions
    {
        public static bool TrySelect(this DataTable Table, string filter, ref DataRow[] matches)
        {
            bool success = true;

            try
            {
                matches = Table.Select(filter);
            }
            catch
            {
                success = false;
            }

            return success && matches.Length > 0;
        }

        public static bool IsString(this DbType type)
        {
            return type == DbType.AnsiString || type == DbType.AnsiStringFixedLength || type == DbType.String || type == DbType.StringFixedLength || type == DbType.Xml;
        }
    }
}
